package missile;

import battlestein.Agent;
/**
 * 
 * @author LocoRocoBattleStein
 *
 */
public class Bomb extends Missile {
	
	private int range;
	/**
	 * Constructor
	 * @param posX
	 * @param posY
	 * @param finalX
	 * @param finalY
	 * @param velocity
	 * @param effectLife
	 * @param effectVelocity
	 * @param range
	 */
	public Bomb(int posX, int posY, int finalX, int finalY, double velocity, int effectLife, int effectVelocity, int range) {
		super(posX, posY, finalX, finalY, velocity, effectLife, effectVelocity);
		this.setImgMissile("medias/bombe.png");
		
		this.range = range;
	}
	
	public boolean hitTestMissile(Agent a) {
		int dist = range - a.getDiameter();
		if(((a.getX() - this.getPosX()) <= dist) && ((a.getY() - this.getPosY()) <= dist)){
    		a.receiveMissile(this.getEffectLife(), 0);
    		return true;
    	}
        return false;
	}
	
	public int getRange() {
		return range;
	}
	public void setRange(int range) {
		this.range = range;
	}

}
